package cn.tedu.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
public class DemoController {
//    http://localhost:8080/springmvc1_war/demo.do
    @GetMapping("/demo.do")
    public String demo() {
        System.out.println("demo()");
        return "Hello World!";
    }
//    http://localhost:8080/springmvc1_war/test.do
    @GetMapping("/test.do")
    public ModelAndView test(){
        System.out.println("test()");
        return new ModelAndView("helloworld!");
    }
    //    http://localhost:8080/springmvc1_war/doc.do
    @GetMapping("doc")
    public ModelAndView doc(){
        System.out.println("测试重定向");
        return new ModelAndView("redirect:http://doc.canglaoshi.org");
    }
}
